<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数值型</title>
</head>
<body>
<script>
    var num=020;
    console.log(num);     //16   解释：0开头的是八进制，这里输出八进制20，是十进制的16
    console.log(0.1+0.2);   //0.30000000000000004  解释：js做小数运算会出现错误，一般推荐转为整数在进行计算，比如这里输出就错了
    console.log((0.1*10+0.2*10)/10);   0.3
    var result = "20";
    var aa = result-10;
    console.log(aa);    //10       解释：js字符串和数值相减时先将字符串转为数值型，在运行减法，结果为number型
    console.log(typeof aa);//number

    var bb = result+10;
    console.log(bb);  //2010
    console.log(typeof bb);  //string       解释：js字符串与数值相加值，返回结果为字符串行拼接
</script>
</body>
</html>